import 'package:fish_redux/fish_redux.dart';

class SubjectState implements Cloneable<SubjectState> {
  bool isSelectable = false;

  String id;
  bool self;
  String sn;
  String period; // 年份
  String title = '';
  String demand = '';
  String sample; // 范文
  String sampleResolve; // 范文解析
  String ideation = ''; // 构思点拨
  String ctime; // 构思点拨
  List<String> gradeList = []; // 适用年级
  List<String> themeList = []; // 作文主题
  List<String> typeList = []; // 习作类型
  List<String> articleTypeList = []; // 体裁
  List<String> editionList = []; // 教材版本
  List<String> tagList = []; // 题型标签
  List<String> keywordList = []; // 题型标签

  SubjectState({
    this.id,
    this.self,
    this.sn,
    this.period, // 年份
    this.title,
    this.demand,
    this.sample, // 范文
    this.sampleResolve, // 范文解析
    this.ideation, // 构思点拨
    this.ctime, // 构思点拨
    this.gradeList, // 适用年级
    this.themeList, // 作文主题
    this.typeList, // 习作类型
    this.articleTypeList, // 体裁
    this.editionList, // 教材版本
    this.tagList, // 题型标签
    this.keywordList, // 题型标签
  });

  factory SubjectState.fromJson(Map<String, dynamic> json) {
    return SubjectState(
      id: json['id'],
      self: json['self'],
      sn: json['sn'],
      period: json['period'],
      title: json['title'],
      demand: json['demand'],
      sample: json['sample'],
      sampleResolve: json['sampleResolve'],
      ideation: json['ideation'],
      ctime: json['ctime'],
      gradeList: List<String>.from(json['gradeList'] ?? []),
      themeList: List<String>.from(json['themeList'] ?? []),
      typeList: List<String>.from(json['typeList'] ?? []),
      articleTypeList: List<String>.from(json['articleTypeList'] ?? []),
      editionList: List<String>.from(json['editionList'] ?? []),
      tagList: List<String>.from(json['tagList'] ?? []),
      keywordList: List<String>.from(json['keywordList'] ?? []),
    );
  }

  @override
  SubjectState clone() {
    return SubjectState()
      ..isSelectable = isSelectable
      ..id = id
      ..self = self
      ..sn = sn
      ..period = period
      ..title = title
      ..demand = demand
      ..sample = sample
      ..sampleResolve = sampleResolve
      ..ideation = ideation
      ..ctime = ctime
      ..gradeList = gradeList
      ..themeList = themeList
      ..typeList = typeList
      ..articleTypeList = articleTypeList
      ..editionList = editionList
      ..tagList = tagList
      ..keywordList = keywordList;
  }

  @override
  String toString() {
    return 'SubjectState{title: $title}';
  }
}

SubjectState initState(SubjectState arg) {
  return arg;
}
